package demo.bocweb.com.sdk.util;

import android.widget.Toast;

import es.dmoral.toasty.Toasty;

/**
 * Created by zhelun on 2018/2/1.
 */

public class ToastyUtil {
    public static void showError(final String errorMsg) {
        /**
         * 保证运行在主线程
         */
        AppUtils.runOnUIThread(new Runnable() {
            @Override
            public void run() {
                Toasty.error(AppUtils.getContext(), errorMsg, Toast.LENGTH_SHORT, true).show();

            }
        });
    }

    public static void showInfo(final String infoMsg) {
        /**
         * 保证运行在主线程
         */
        AppUtils.runOnUIThread(new Runnable() {
            @Override
            public void run() {
                Toasty.info(AppUtils.getContext(), infoMsg, Toast.LENGTH_SHORT, true).show();

            }
        });
    }

    public static void showWarning(final String warningMsg) {
        /**
         * 保证运行在主线程
         */
        AppUtils.runOnUIThread(new Runnable() {
            @Override
            public void run() {
                Toasty.warning(AppUtils.getContext(), warningMsg, Toast.LENGTH_SHORT, true).show();

            }
        });
    }

    public static void showSuccess(final String successMsg) {
        /**
         * 保证运行在主线程
         */
        AppUtils.runOnUIThread(new Runnable() {
            @Override
            public void run() {
                Toasty.success(AppUtils.getContext(), successMsg, Toast.LENGTH_SHORT, true).show();

            }
        });
    }

    public static void showNormal(final String normalMsg) {
        /**
         * 保证运行在主线程
         */
        AppUtils.runOnUIThread(new Runnable() {
            @Override
            public void run() {
                Toasty.normal(AppUtils.getContext(), normalMsg, Toast.LENGTH_SHORT).show();

            }
        });
    }

}
